<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>

<div id="app">
  <cpn></cpn>
  <cpn1></cpn1>
</div>

<!-- 1. 分离写法一: -->
<script type="text/x-template" id="cpn">
  <div>
    <h2>我是小标题</h2>
    <p>今天天气不错</p>
  </div>
</script>

<!-- 2. 分离写法二: -->
<template id="cpn1">
  <div>
    <h2>我是小标题</h2>
    <p>小伙脖子上长了个怪包</p>
  </div>
</template>


<script src="../js/vue.js"></script>
<script>
  // 1. 注册一个全局组件
  Vue.component('cpn', {
    template: '#cpn'
  });

  Vue.component('cpn1', {
    template: '#cpn1'
  });

  const app = new Vue({
    el: '#app',
    data: 
    {
      message: '你好呀',
    },
  })
</script>
  
</body>
</html>